package com.sky.controller.test;


import com.atom.module.common.result.Result;
import com.sky.test.BeanTest;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/bean")
@Tag(name = "测试：Bean")
public class BeanController {

    @Autowired
    private BeanTest test;

    @GetMapping("/{message}")
    public Result<?> sendMessage(@PathVariable("message") String message) {
        ThreadPoolTaskExecutor threadPoolTaskExecutor = test.taskThreadPoolTaskExecutor();
        log.info(" Bean Test {}  / Bean {} / Executor {}" ,message ,  test , threadPoolTaskExecutor);
        test.taskThreadPoolTaskExecutor().submit(new Runnable() {
            @Override
            public void run() {
                log.info(" Bean Test {} , {}" , test , message);
            }
        });
        return Result.success();
    }

}
